Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
What is "elementHandle.contentFrame()" in PlayWright?

I just solved a problem using "elementHandle.contentFrame()", but not really know what's going on behind it. So, I was trying to select a DOM element and click on it. But I realized that I couldn't just simply do it like this when the element is wrapped inside a frame:

{
    await page.click('<element>');
}

So, I applied this method ("elementHandle.contentFrame()") and it works!

{
    const handle = await page.$('frame');
    const contentFrame = await handle.contentFrame();

    await contentFrame.click('<selector>');
}

Can someone explain to me the concept behind it? Thanks!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You don't have to use contentFrame, page.frame('frame-name') can give you a frame instance as well.

Basically you can think iframe is a page inside another page, so that you have to first find that frame if you want select the element inside a iframe

about 4 years ago · Juan Pablo Isaza Denunciar

0

The handle you have in the handle variable represents iframe element inside the page. With that variable, you can read or manipulate that element in the same way you can do with any other DOM element on that page. But you can't access the HTML content that iframe rendered.

That's why, if you want to interact with the content inside that frame you need to get the frame using contentFrame.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda